@extends('layout.userinfo')
@section('content')

    @if (count($errors) > 0)
        <div class="alert alert-danger">
            <ul>
                @foreach ($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    @endif
    <div class="profile-panel" role="main">
        <h3 ng-if="pageTitleVisible" class="profile-paneltitle ng-scope"><span ng-bind="pageTitle" class="ng-binding">绑定手机</span> <span class="subtitle ng-binding" ng-bind-html="pageSubtitle | toTrusted"></span></h3>
        <form class="security-service ng-scope ng-pristine ng-valid" ng-show="currentStep === 1" name="myform" action="/updatePhone" method="post">
            {!!csrf_field()!!}
            <p class="service-text">为保障你的账号安全，请先帮助我们验证你的身份！</p>
            <div class="field-default formfield ng-isolate-scope" ng-class="{ 'validate-error': model.$hintTypes[property] === 'error' }" form-field="" label="原手机号码">
                <label ng-bind="label" class="ng-binding">原手机号码</label>
                <span class="field-default-value default-mobile ng-binding ng-scope" ng-bind="user.mobile | mobileMask">{{$res->phone}}</span>

            </div>
            <div class="formfield form-field-verifymobile ng-isolate-scope" >
                <label ng-bind="label" class="ng-binding">新手机号</label>
                <input id="phone1" type="text"  name="phone1" class="ng-pristine ng-valid" />
            </div>
            <div class="formfield form-field-verifymobile ng-isolate-scope">
                <input type="text" name="yanzhengma" id="to"/>
                <button type="button" id="yanzheng1" >获取验证码</button>
            </div>
            <div class="form-group">
                <button type="submit" id="tijiao" class="btn-primary btn-lg security-submit">提交</button>
            </div>
        </form>
    </div>

@endsection
<script src="/elm_home/js/jquery-1.8.2.min.js" type="text/javascript"></script>
<script>

    $(function(){
        $.ajaxSetup({
            headers: { 'X-CSRF-TOKEN' : '{{csrf_token()}}' }
        });

        $('#yanzheng1').click(function(){
          var phone1 = $('#phone1').val();
            $.post("updatePhone", { yanzheng: phone1 },
                    function(data){
                        console.log(data);
                    });
        })




    })

</script>